package com.lx.gulimall.seckill.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

/**
 * @author lixun Email:lx3027@126.com
 * @create 2021-08-20 13:58
 *
 * @EnableScheduling： 开启定时任务
 *        @Scheduled： 开启一个定时任务
 *
 * @EnableAsync: 开启异步任务
 *       @Async: 希望异步执行的方法
 */
@Component
//@EnableScheduling
//@EnableAsync
@Slf4j
public class HelloScheduled {

    @Async
    @Scheduled(cron = "* * * * * ?")
    public void hello(){
        log.info("时间...");
    }

}
